Saute the onions until tender. Add the mushrooms and thyme and continue sauteing until the mushrooms release their juices.
Add the Marsala and continue cooking until the liquid is reduced by half. Season to taste, then sprinkle with 1 T flour and stir until the mixture thickens slightly. Remove from heat and cool.
Fit one pie pastry into the bottom of a 9-inch pie plate, then fill with the mushroom mixture. Dampen the edge of the pastry with water, top with the second pastry, pressing the edges to seal. Trim and flute the edges.
Whisk together the egg yolk with 1 1/2t water, then baste the pastry with the mixture. Bake at 400 until the crust is golden, about 35 minutes.